<!--
 * @Author: hq
 * @Date: 2022-05-28 19:29:52
 * @LastEditors: hq
 * @LastEditTime: 2022-06-14 15:58:26
 * @Description: 添加物料弹窗
 * @version: 1.0
-->
<template>
  <div class="change">
    <el-row>
      <el-col :span="12">
        <el-form
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-form-item label="选择商品">
            <div class="col">
              <div class="clickshop hand_cs" @click="selectShop">
                点击选择商品
              </div>
              <div>参数参数</div>
            </div>
          </el-form-item>
          <el-form-item label="标记分组" :required="true">
            <el-select v-model="ClassifyId" placeholder="请选择">
              <el-option
                v-for="item in ClassifyArr"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="展示时间" :required="true">
            <el-date-picker
              value-format="yyyy-MM-dd HH:mm:ss"
              v-model="time"
              type="datetimerange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="启用状态" :required="true">
            <el-switch v-model="status"> </el-switch>
          </el-form-item>
          <el-form-item label="备注" :required="true">
            <el-input
              type="textarea"
              :rows="2"
              v-model="remark"
              placeholder="请输入备注"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')"
              >确定</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <!-- 商品列表 -->
    <el-dialog
      class="shopDialog"
      :title="title"
      :visible.sync="shopDialog"
      width="900px"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <Dialog v-if="shopDialog" @handleClose="handleClose"></Dialog>
    </el-dialog>
  </div>
</template>

<script>
import Dialog from "./shop_list_dialog.vue";
export default {
  components: { Dialog },
  props: ["rowData"],
  data() {
    return {
      rowId: "",
      status: false,
      time: "",
      remark: "",
      ClassifyArr: [],
      ClassifyId: "",
      rules: {},
      shopDialog: false, //商品弹窗
    };
  },
  methods: {
    selectShop() {
      this.shopDialog = true;
    },
    submitForm() {
      this.$emit("handleClose");
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          //接口
        }
      });
    },
  },
  created() {
    if (this.rowData.id) {
      //编辑
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/style/index.scss";
/deep/.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 80px;
  height: 80px;
  line-height: 80px;
  text-align: center;
}
.avatar {
  width: 80px;
  height: 80px;
  display: block;
}
.col {
  display: flex;
  font-size: 13px;
  .clickshop {
    border: 1px solid $color-primary8;
    background-color: $color-primary7;
    color: $color-primary1;
    border-radius: 4px;
    height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
.shopDialog {
  //   z-index: 2005 !important;
  /deep/.el-dialog {
    height: 75%;
    .el-dialog__body {
      height: 80%;
      overflow: auto;
    }
  }
}
</style>
